import com.sun.xml.internal.ws.addressing.WsaActionUtil;


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
            String pattern = scanner.nextLine();
            String s = scanner.nextLine();

            char[] ch = new char[300];
            for (int i = 0; i < pattern.length(); i++) {
                ch[i] = pattern.charAt(i);
            }

            String[] dest = s.split(" ");

            if(pattern.length() != dest.length){
                System.out.println("false");
                return;
            }
            for (int i = 0; i < pattern.length(); i++) {
                for (int j = i+1; j < pattern.length(); j++) {
                    if(ch[i] == ch[j]){
                        if(!dest[i].equals(dest[j])){
                            System.out.println("false");
                            return;
                        }
                    }else{
                        if(dest[i].equals(dest[j])){
                            System.out.println("false");
                            return;
                        }
                    }

                }

            }
            System.out.println("true");

        }
    }
}
